package com.study;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

public class TestDemo02 {
    public static void main(String[] args) {
        File file = new File("d:/log.txt");
        //showFileList(file);

        try {
            FileInputStream fis = new FileInputStream(file);
            int i = 0;
            while((i=fis.read())!= -1){
                System.out.print((char)i);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void showFileList(File file){
        File[] files = file.listFiles();
        for (int i = 0; i < files.length; i++) {
            File file1 = files[i];
            if(file1.isFile()) {
                System.out.println(file1.getName());
            }else{
                showFileList(files[i]);
            }
        }
    }
}
